<?php
class IndexBusiness1 extends CWidget
{
	public $sort='01';
	public $sum=6;
	private $sort_name=array(
	'0101'=>'欧美家具',
	'0102'=>'古典家具',
	'0103'=>'现代板式',
	'0104'=>'现代实木',
	'0105'=>'烤漆家具',
	'0106'=>'红木家具',
	'0107'=>'青少年家具',
	'0201'=>'沙　　发',
	'0202'=>'床、床垫',
	'0501'=>'藤　　器',
	'0502'=>'户外家具',
	'0503'=>'休闲椅　',
	'03'=>'办公家具',
	'04'=>'低碳环保',
	);
	
	public function run()
	{
		$criteria=new CDbCriteria;
		$criteria->addCondition('FIND_IN_SET("'.$this->sort.'",product_sort)>0');
		$criteria->addCondition('state=0 and recommend1>0');
		$criteria->limit=$this->sum;
		$criteria->order='recommend1 desc,update_time desc';
		$models=Business::model()->findAll($criteria);
		$this->render('index_business',array('models'=>$models,'sort_name'=>array($this->sort,$this->sort_name[$this->sort])));
	}

	
}